package ext.acae2.document.view;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Vector;

import wt.doc.WTDocument;
import wt.util.WTException;
import wt.util.WTMessage;

import com.ptc.core.components.descriptor.DescriptorConstants.ColumnIdentifiers;
import com.ptc.core.htmlcomp.components.JCAConfigurableTable;
import com.ptc.core.htmlcomp.createtableview.Attribute;
import com.ptc.core.htmlcomp.tableview.TableColumnDefinition;
import com.ptc.core.htmlcomp.tableview.TableViewDescriptor;

import ext.acae2.document.resource.DocResource;


/**
 * @desription ECM 答复Table的视图信息
 * @author cnie
 * @date 2013-7-15 下午2:49:17
 */
public class ECMRecommendTableView extends JCAConfigurableTable{
	
	
	public ECMRecommendTableView(){}


	private static final String RESOURCE = DocResource.class.getName();
	public static final String ALL_VIEW = getViewResourceEntryKey(RESOURCE,
			"ALL_VIEW_NAME");
	
	public static final String WEIDAFU_VIEW_NAME = getViewResourceEntryKey(RESOURCE,
			"WEIDAFU_VIEW_NAME");
	
	public static final String YUDAFU_VIEW_NAME = getViewResourceEntryKey(RESOURCE,
			"YUDAFU_VIEW_NAME");
	public static final String WUXUDAFU_VIEW_NAME = getViewResourceEntryKey(RESOURCE,
			"WUXUDAFU_VIEW_NAME");
	
	public static final String ECM_REPLY_STATE="ECM_REPLY_STATE";

	/* (non-Javadoc)
	 * @see com.ptc.core.htmlcomp.tableview.ConfigurableTable#getLabel(java.util.Locale)
	 */
	@Override
	public String getLabel(Locale locale) {
		return WTMessage.getLocalizedMessage(RESOURCE,
				DocResource.CREATE_DOCUMENT_RELEATED_LINK, null, locale);
	}

	/* (non-Javadoc)
	 * @see com.ptc.core.htmlcomp.tableview.ConfigurableTable#getSpecialTableColumnsAttrDefinition(java.util.Locale)
	 */
	@Override
	public List getSpecialTableColumnsAttrDefinition(Locale locale) {
		List result =  new ArrayList(1);
        result.add(new Attribute.TextAttribute(ColumnIdentifiers.NM_ACTIONS,  WTMessage.getLocalizedMessage("com.ptc.core.ui.componentRB", "ACTIONS", null, locale), locale));
		return new ArrayList();
	}

	/* (non-Javadoc)
	 * @see com.ptc.core.htmlcomp.tableview.ConfigurableTable#getClassTypes()
	 */
	@Override
	public Class[] getClassTypes() {
		// TODO Auto-generated method stub
		return new Class[]{WTDocument.class};
	}

	/* (non-Javadoc)
	 * @see com.ptc.core.htmlcomp.tableview.ConfigurableTable#getOOTBTableViews(java.lang.String, java.util.Locale)
	 */
	@Override
	public List getOOTBTableViews(String tableId, Locale locale) throws WTException {
		List views = new ArrayList();
		Vector columns = getColumns();
		TableViewDescriptor allView = TableViewDescriptor.newTableViewDescriptor(ALL_VIEW, tableId, true,
		        true, columns, null, true, ALL_VIEW);
		TableViewDescriptor weiDaFuView = TableViewDescriptor.newTableViewDescriptor(WEIDAFU_VIEW_NAME, tableId, true, true, columns, null, true, WEIDAFU_VIEW_NAME);
		TableViewDescriptor yuDaFuView = TableViewDescriptor.newTableViewDescriptor(YUDAFU_VIEW_NAME, tableId, true, true, columns, null, true, YUDAFU_VIEW_NAME);
		TableViewDescriptor wuYuDaFuView = TableViewDescriptor.newTableViewDescriptor(WUXUDAFU_VIEW_NAME, tableId, true, true, columns, null, true, WUXUDAFU_VIEW_NAME);
		views.add(allView);
		views.add(weiDaFuView);
		views.add(yuDaFuView);
		views.add(wuYuDaFuView);
		return views;
	}

	/* (non-Javadoc)
	 * @see com.ptc.core.htmlcomp.tableview.ConfigurableTable#getOOTBActiveViewName()
	 */
	@Override
	public String getOOTBActiveViewName() {
		return ALL_VIEW;
	}

	/* (non-Javadoc)
	 * @see com.ptc.core.htmlcomp.tableview.ConfigurableTable#getDefaultSortColumn()
	 */
	@Override
	public String getDefaultSortColumn() {
		return ColumnIdentifiers.NUMBER;
	}
	
	protected Vector getColumns() throws WTException {
		Vector vector = new Vector();

		vector.add(TableColumnDefinition.newTableColumnDefinition(
				ColumnIdentifiers.ICON, false));
		vector.add(TableColumnDefinition.newTableColumnDefinition(ColumnIdentifiers.FORMAT_ICON,false));
		TableColumnDefinition numberDef = TableColumnDefinition.newTableColumnDefinition(ColumnIdentifiers.NUMBER,
				false);
		vector.add(numberDef);
		vector.add(TableColumnDefinition.newTableColumnDefinition(ColumnIdentifiers.NAME,
				false));
		
		vector.add(TableColumnDefinition.newTableColumnDefinition(ColumnIdentifiers.VERSION,
				false));
		
		vector.add(TableColumnDefinition.newTableColumnDefinition(
				ColumnIdentifiers.LAST_MODIFIED, false));
		
		vector.add(TableColumnDefinition.newTableColumnDefinition("ECM_REPLY_STATE",
				false));
		
		vector.add(TableColumnDefinition.newTableColumnDefinition("REPLY_ECM_NUMBER",
				false));

		return vector;
	}

}
